Elements of Clojure by Zachary Tellman

Elements of Clojure by Zachary Tellman

Author:Zachary Tellman [Zachary Tellman]
Language: eng
Format: epub
Publisher: leanpub.com
Published: 2016-03-17T00:00:00+00:00


A Model for Modules

Most software abstractions take the form of a module, which consists of a model, an interface, and an environment.

The model is a collection of data and functions. The interface is the means by which the model and environment interact. The environment is everything else: other software components, the users, and the world they exist in.

Models reflect specific facets of their environment. They narrow our attention, giving us the ability to reason about something that is endlessly complex and to change it in predictable ways. Everything the model does not reflect represents an assumption that these missing facets are either fixed or irrelevant. If a model can represent invalid states, it must enforce invariants that preclude those states.

In the context of our mechanical clock, the model is the inner clockwork, which enforces an invariant relationship between the passage of time and the turning of its gears. The interface is the clock’s hands and dial, as well as the winding mechanism. The clock assumes that it will be regularly wound and that the clockwork won’t be subjected to any forces that prevent it from doing its job. If those assumptions are false in our particular context, then the clock is no longer a useful tool for telling time.



Download



Copyright Disclaimer:
This site does not store any files on its server. We only index and link to content provided by other sites. Please contact the content providers to delete copyright contents if any and email us, we'll remove relevant links or contents immediately.